package io.sqrtqiezi.practise.hadoop.sort.secondary;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class DateTemperatureGroupingComparator extends WritableComparator {
    public DateTemperatureGroupingComparator() {
        super(DateTemperaturePair.class, true);
    }

    @Override
    public int compare(WritableComparable wc1, WritableComparable wc2) {
        final DateTemperaturePair pair1 = (DateTemperaturePair) wc1;
        final DateTemperaturePair pair2 = (DateTemperaturePair) wc2;

        return pair1.getYearMonth().compareTo(pair2.getYearMonth());
    }
}
